package ui;

import java.awt.*;

import javax.swing.*;

import logic.ACListLogin;
import data.Connect;

public class GlobalScreen extends JFrame {

	public final static Dimension SIZE = new Dimension(815, 600);

	/**
	 * Create the frame.
	 */
	public GlobalLogin globallogin;
	public UserUI userui;
	public Connect connect;
	public AdminUI adminui;
	public GlobalLogoutPanel globallogoutpanel;
	public AdminPanel adminpanel;

	public GlobalScreen() {

		setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		
		getContentPane().setLayout(new CardLayout());
		
	    globallogoutpanel = new GlobalLogoutPanel();
		connect = new Connect();
		globallogin = new GlobalLogin();
		adminui = new AdminUI(globallogoutpanel);
		userui = new UserUI(globallogoutpanel);
		
		
		
		
		add(adminui,"adminui");
		add(userui,"userui");
		add(globallogin,"globallogin");
		show("globallogin");
		
		ACListLogin ac = new ACListLogin(this, globallogin, connect, adminui, globallogoutpanel, userui);
		globallogin.addAcListener(ac);
		globallogoutpanel.addACList(ac);
		

		setVisible(true);
		setTitle("Bitcoin ATM");
		setSize(SIZE);
	}
	
	public void show(String panel){
		((CardLayout)getContentPane().getLayout()).show(getContentPane(), panel);
	}

	public GlobalLogin getLogin() {
		return globallogin;
	}

	public void setLogin(GlobalLogin login) {
		this.globallogin = login;
	}

	public UserUI getUserui() {
		return userui;
	}

	public void setUserui(UserUI userui) {
		this.userui = userui;
	}

	public AdminUI getAdmin() {
		return adminui;
	}

	public void setAdmin(AdminUI admin) {
		this.adminui = admin;
	}
	
}
